package test.examation;

class Node{
    int data;
    Node next;
}

public class 跟谁学 {
    public static void main(String[] args) {
//        String s="(u(love)i)";
//        System.out.println(reverseParentheses(s));
        Integer a=200;
        Integer b=200;
        System.out.println(a==b);

    }
    public static String reverseParentheses(String s){//反转括号内的字符串
        if(s.length()<=1) return s;

        StringBuilder sb=new StringBuilder();
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='('){
                int j=i,m=0;
                for(;j<s.length();j++){
                    if(s.charAt(j)=='(') m++;
                    if(s.charAt(j)==')') m--;
                    if(m==0) break;
                }
                StringBuilder temp=new StringBuilder(reverseParentheses(s.substring(i+1,j)));
                for(int k=temp.length()-1;k>=0;k--){
                    sb.append(temp.charAt(k));
                }
                i=j;
            }else{
                sb.append(s.charAt(i));
            }
        }
        return sb.toString();

    }
    public Node mergeTwoLists(Node n1,Node n2){//合并俩个有序链表
        if(n1==null) return n2;
        if(n2==null) return n1;
        if(n1.data<=n2.data){
            n1.next=mergeTwoLists(n1.next,n2);
            return n1;
        }else{
            n2.next=mergeTwoLists(n1,n2.next);
            return  n2;
        }
    }
}
